<?php
use Doctrine\ORM\EntityRepository;
use entities\UserAccount;
use entities\AccountCurrency;
use entities\AccountType;
use entities\Account;


class DashboardController
	extends BaseController
{
	public function start()
	{
		$this->registry->template->arr_jsScriptUrls = $this->arr_appConf['js_files'];
		$this->registry->template->arr_cssSriptUrls = $this->arr_appConf['css_style_sheets'];
		
		/*
		//user creation
		$o_usr = new UserAccount();	
		$o_usr->setEmail('ayo2@ayo.com');
		$o_usr->setPassword('test2');
		$o_usr->setDateChanged(new \DateTime("now"));
		$o_usr->setDateCreated(new \DateTime("now"));
		$o_usr->setAccessType(1);
		$this->o_em->persist($o_usr);
		$this->o_em->flush();
		
		//currency maker
		$o_currency = new AccountCurrency();
		$o_currency->setName('us dollar');
		$o_currency->setLabelSingle('dollar');
		$o_currency->setLabelPlural('dollars');
		$o_currency->setDateCreated(new \DateTime("now"));
		$o_currency->setDateChanged(new \DateTime("now"));
		$this->o_em->persist($o_currency);
		$this->o_em->flush();
		
		//account type maker
		$o_accountType = new AccountType();
		$o_accountType->setDescription('lorem ipsum long very very very very very long description, lorem ipsum long very very very very very long description');
		$o_accountType->setShortDescription('lorem ipsum short description');
		$o_accountType->setLabel('personal expense');
		$o_accountType->setDateCreated(new \DateTime("now"));
		$o_accountType->setDateChanged(new \DateTime("now"));
		$this->o_em->persist($o_accountType);
		$this->o_em->flush();
		
		//account creation
		$o_newAcc = new Account();
		$o_user = $this->o_em->find('entities\UserAccount', 1);
		$o_newAcc->setUser($o_user);
		$o_newAcc->setCurrency($this->o_em->find('entities\AccountCurrency', 1));
		$o_newAcc->setDateCreated(new \DateTime("now"));
		$o_newAcc->setDateChanged(new \DateTime("now"));
		$o_newAcc->setDescription('lorem ipsum long very very very very very long description, lorem ipsum long very very very very very long description');
		$o_newAcc->setBalance(0.00);
		$o_newAcc->setName('3rd test savings bank account');
		$o_newAcc->setType($this->o_em->find('entities\AccountType', 3));
		
		//$o_user->addAccount($o_newAcc);
		$this->o_em->persist($o_newAcc);
		
		$this->o_em->flush();
		*/
		//$this->o_em->find('UserAccount', 1);
		$o_navi = new ClaycodeNaviMenu(
			$this->o_configuration->getApplicationsArray(), 
			array(
				'pretty_urls'=> true,
				'is_sub_navi'=> false
			)
		);
		$this->registry->template->s_navi = $o_navi->getNaviHtml();
		$this->registry->template->show('Dashboard.php');
	}
}